package de.tudarmstadt.ukp.wikisniffer.userstudy.gui;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

import de.tudarmstadt.ukp.wikisniffer.userstudy.Client;
import de.tudarmstadt.ukp.wikisniffer.userstudy.gui.intro.PrepareForQuestionGui;
import de.tudarmstadt.ukp.wikisniffer.userstudy.gui.intro.TextGui;
import de.tudarmstadt.ukp.wikisniffer.userstudy.gui.questions.MultipleChoiceQuestion;
import de.tudarmstadt.ukp.wikisniffer.userstudy.gui.questions.VpCodeQuestion;
import de.tudarmstadt.ukp.wikisniffer.userstudy.gui.rtool.RToolTextGui;
import de.tudarmstadt.ukp.wikisniffer.userstudy.util.Question;
import de.tudarmstadt.ukp.wikisniffer.userstudy.util.QuestionGroup;

public class GuiFactory {
	
	static public AbstractInfoGui smallTextGui(String text){	
		TextGui gui = new TextGui();
		gui.setText(text,Client.smallScreen);
		return gui;
	}
	
	static public AbstractInfoGuiWithoutButton smallRToolTextGui(String text)
	{
		RToolTextGui gui = new RToolTextGui();
		gui.setText(text, Client.smallScreen);
		return gui;
	}
	
	
	static public AbstractInfoGui bigTextGui(String text){	
		TextGui gui = new TextGui();
		gui.setText(text,Client.bigScreen);
		return gui;
	}
	
	static public RepeatGui openRepeatGui(String text){	
		RepeatGui gui = new RepeatGui();
		gui.setText(text);
		return gui;
	}
	
	static public List<AbstractGui> openMultipleChoiceQuestionGui(){
		Question question = Client.client.questionStore.getCurrentQuestionGroup().getNewQuestion();
		
		List<AbstractGui> guis = new ArrayList<AbstractGui>();
		
		MultipleChoiceQuestion gui = new MultipleChoiceQuestion();
		gui.init(question);
		
		guis.add(gui);
		
		return guis;
	}

	public static Collection<? extends AbstractGui> openMultipleChoiceQuestionGui(
			Question question) {
		List<AbstractGui> guis = new ArrayList<AbstractGui>();
				
		MultipleChoiceQuestion gui = new MultipleChoiceQuestion();
		gui.init(question);
		
		guis.add(gui);
		
		return guis;
	}
	
	public static Collection<? extends AbstractGui> openPrepareForQuestionGui(
			String topic, boolean isTrialRun) {
		List<AbstractGui> guis = new ArrayList<AbstractGui>();
				
		PrepareForQuestionGui gui = new PrepareForQuestionGui(isTrialRun);
		gui.setText(topic,Client.smallScreen);
		
		guis.add(gui);
		
		return guis;
	}
	public static Collection<? extends AbstractGui> openPrepareForQuestionGui(
			QuestionGroup questionGroup, boolean isTrialRun) {
		return openPrepareForQuestionGui(questionGroup.getTopic(), isTrialRun);
	}
	
	public static Collection<? extends AbstractGui> openPresentTopicGui(
			String topic) {
		List<AbstractGui> guis = new ArrayList<AbstractGui>();
				
		TextGui gui = new TextGui();
		gui.setText(topic,Client.bigScreen);
		
		guis.add(gui);
		
		return guis;
	}
	
	public static Collection<? extends AbstractGui> openPresentTopicGui(
			QuestionGroup questionGroup) {
		return openPresentTopicGui(questionGroup.getTopic());
		}
	
	public static AbstractQuestionGui openVpCodeGui(String text){
		VpCodeQuestion gui = new VpCodeQuestion();
		gui.init(text);
		return gui;
	}
}
